﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Threading;

using CloudTrace.Reader;
using System.ComponentModel;

namespace TestReadConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            QueueReader reader = new QueueReader();
            bool quit = false;

            while (!quit)
            {
                string message = reader.GetPlainTextMessage();
                while (!string.IsNullOrEmpty(message))
                {
                    System.Console.WriteLine(message);
                    message = reader.GetPlainTextMessage();
                }

                Thread.Sleep(1000);

                if (Console.KeyAvailable)
                {
                    ConsoleKeyInfo info = Console.ReadKey(false);
                    quit = (info.KeyChar == 'q');
                }
            }
        }
    }
}
